package com.example.HeadFirstDemo.Singleton;

public class SingletonDemo1 {
    private static SingletonDemo1 singletonDemo1=new SingletonDemo1();

    /*
    * 内部构造类，禁止外部加载
     */
    private SingletonDemo1(){

    }

    //直接返回一个静态方法
    public static SingletonDemo1 getInstance(){
        return singletonDemo1;
    }
}
